<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The SolrInputDocument class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="solrutils.queryphrase.html">« SolrUtils::queryPhrase</a></li>
      <li style="float: right;"><a href="solrinputdocument.addchilddocument.html">SolrInputDocument::addChildDocument »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.solr.html">Solr</a></li>
    <li>The SolrInputDocument class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.solrinputdocument" class="reference">

 <h1 class="title">The SolrInputDocument class</h1>
 

 <div class="partintro"><p class="verinfo">(PECL solr &gt;= 0.9.2)</p>


  <div class="section" id="solrinputdocument.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    This class represents a Solr document that is about to be submitted to the Solr index.
   </p>
  </div>


  <div class="section" id="solrinputdocument.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">final</span>
      <span class="modifier">class</span> <strong class="classname">SolrInputDocument</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 常量 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.solrinputdocument.html#solrinputdocument.constants.sort-default"><var class="varname">SORT_DEFAULT</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.solrinputdocument.html#solrinputdocument.constants.sort-asc"><var class="varname">SORT_ASC</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.solrinputdocument.html#solrinputdocument.constants.sort-desc"><var class="varname">SORT_DESC</var></a></var><span class="initializer"> = 2</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.solrinputdocument.html#solrinputdocument.constants.sort-field-name"><var class="varname">SORT_FIELD_NAME</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.solrinputdocument.html#solrinputdocument.constants.sort-field-value-count"><var class="varname">SORT_FIELD_VALUE_COUNT</var></a></var><span class="initializer"> = 2</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.solrinputdocument.html#solrinputdocument.constants.sort-field-boost-value"><var class="varname">SORT_FIELD_BOOST_VALUE</var></a></var><span class="initializer"> = 4</span>;</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.construct.html" class="methodname">__construct</a></span>()</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.addchilddocument.html" class="methodname">addChildDocument</a></span>(<span class="methodparam"><span class="type"><a href="class.solrinputdocument.html" class="type SolrInputDocument">SolrInputDocument</a></span> <code class="parameter">$child</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.addchilddocuments.html" class="methodname">addChildDocuments</a></span>(<span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$docs</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.addfield.html" class="methodname">addField</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$fieldName</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$fieldValue</code></span>, <span class="methodparam"><span class="type">float</span> <code class="parameter">$fieldBoostValue</code><span class="initializer"> = 0.0</span></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.clear.html" class="methodname">clear</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.clone.html" class="methodname">__clone</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.deletefield.html" class="methodname">deleteField</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$fieldName</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.fieldexists.html" class="methodname">fieldExists</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$fieldName</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.getboost.html" class="methodname">getBoost</a></span>(): <span class="type">float</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.getchilddocuments.html" class="methodname">getChildDocuments</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.getchilddocumentscount.html" class="methodname">getChildDocumentsCount</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.getfield.html" class="methodname">getField</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$fieldName</code></span>): <span class="type"><a href="class.solrdocumentfield.html" class="type SolrDocumentField">SolrDocumentField</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.getfieldboost.html" class="methodname">getFieldBoost</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$fieldName</code></span>): <span class="type">float</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.getfieldcount.html" class="methodname">getFieldCount</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.getfieldnames.html" class="methodname">getFieldNames</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.haschilddocuments.html" class="methodname">hasChildDocuments</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.merge.html" class="methodname">merge</a></span>(<span class="methodparam"><span class="type"><a href="class.solrinputdocument.html" class="type SolrInputDocument">SolrInputDocument</a></span> <code class="parameter">$sourceDoc</code></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$overwrite</code><span class="initializer"> = <strong><code>true</code></strong></span></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.reset.html" class="methodname">reset</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.setboost.html" class="methodname">setBoost</a></span>(<span class="methodparam"><span class="type">float</span> <code class="parameter">$documentBoostValue</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.setfieldboost.html" class="methodname">setFieldBoost</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$fieldName</code></span>, <span class="methodparam"><span class="type">float</span> <code class="parameter">$fieldBoostValue</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.sort.html" class="methodname">sort</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$sortOrderBy</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$sortDirection</code><span class="initializer"> = SolrInputDocument::SORT_ASC</span></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.toarray.html" class="methodname">toArray</a></span>(): <span class="type">array</span></div>

    <div class="destructorsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="solrinputdocument.destruct.html" class="methodname">__destruct</a></span>()</div>

   }</div>


  </div>
  

  <div class="section" id="solrinputdocument.constants">
   <h2 class="title">预定义常量</h2>
   <div class="section" id="solrinputdocument.constants.types">
    <h2 class="title">SolrInputDocument Class Constants</h2>
    <dl>

     
      <dt id="solrinputdocument.constants.sort-default"><strong><code>SolrInputDocument::SORT_DEFAULT</code></strong></dt>

      <dd>

       <p class="para">Sorts the fields in ascending order.</p>
      </dd>

     

     
      <dt id="solrinputdocument.constants.sort-asc"><strong><code>SolrInputDocument::SORT_ASC</code></strong></dt>

      <dd>

       <p class="para">Sorts the fields in ascending order.</p>
      </dd>

     

     
      <dt id="solrinputdocument.constants.sort-desc"><strong><code>SolrInputDocument::SORT_DESC</code></strong></dt>

      <dd>

       <p class="para">Sorts the fields in descending order.</p>
      </dd>

     

     
      <dt id="solrinputdocument.constants.sort-field-name"><strong><code>SolrInputDocument::SORT_FIELD_NAME</code></strong></dt>

      <dd>

       <p class="para">Sorts the fields by name</p>
      </dd>

     

     
      <dt id="solrinputdocument.constants.sort-field-value-count"><strong><code>SolrInputDocument::SORT_FIELD_VALUE_COUNT</code></strong></dt>

      <dd>

       <p class="para">Sorts the fields by number of values.</p>
      </dd>

     

     
      <dt id="solrinputdocument.constants.sort-field-boost-value"><strong><code>SolrInputDocument::SORT_FIELD_BOOST_VALUE</code></strong></dt>

      <dd>

       <p class="para">Sorts the fields by boost value.</p>
      </dd>

     

    </dl>

   </div>
  </div>



 </div>

 


































































































































































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="solrinputdocument.addchilddocument.html">SolrInputDocument::addChildDocument</a> — Adds a child document for block indexing</li><li><a href="solrinputdocument.addchilddocuments.html">SolrInputDocument::addChildDocuments</a> — Adds an array of child documents</li><li><a href="solrinputdocument.addfield.html">SolrInputDocument::addField</a> — Adds a field to the document</li><li><a href="solrinputdocument.clear.html">SolrInputDocument::clear</a> — Resets the input document</li><li><a href="solrinputdocument.clone.html">SolrInputDocument::__clone</a> — Creates a copy of a SolrDocument</li><li><a href="solrinputdocument.construct.html">SolrInputDocument::__construct</a> — Constructor</li><li><a href="solrinputdocument.deletefield.html">SolrInputDocument::deleteField</a> — Removes a field from the document</li><li><a href="solrinputdocument.destruct.html">SolrInputDocument::__destruct</a> — Destructor</li><li><a href="solrinputdocument.fieldexists.html">SolrInputDocument::fieldExists</a> — Checks if a field exists</li><li><a href="solrinputdocument.getboost.html">SolrInputDocument::getBoost</a> — Retrieves the current boost value for the document</li><li><a href="solrinputdocument.getchilddocuments.html">SolrInputDocument::getChildDocuments</a> — Returns an array of child documents (SolrInputDocument)</li><li><a href="solrinputdocument.getchilddocumentscount.html">SolrInputDocument::getChildDocumentsCount</a> — Returns the number of child documents</li><li><a href="solrinputdocument.getfield.html">SolrInputDocument::getField</a> — Retrieves a field by name</li><li><a href="solrinputdocument.getfieldboost.html">SolrInputDocument::getFieldBoost</a> — Retrieves the boost value for a particular field</li><li><a href="solrinputdocument.getfieldcount.html">SolrInputDocument::getFieldCount</a> — Returns the number of fields in the document</li><li><a href="solrinputdocument.getfieldnames.html">SolrInputDocument::getFieldNames</a> — Returns an array containing all the fields in the document</li><li><a href="solrinputdocument.haschilddocuments.html">SolrInputDocument::hasChildDocuments</a> — Returns true if the document has any child documents</li><li><a href="solrinputdocument.merge.html">SolrInputDocument::merge</a> — Merges one input document into another</li><li><a href="solrinputdocument.reset.html">SolrInputDocument::reset</a> — 别名 SolrInputDocument::clear</li><li><a href="solrinputdocument.setboost.html">SolrInputDocument::setBoost</a> — Sets the boost value for this document</li><li><a href="solrinputdocument.setfieldboost.html">SolrInputDocument::setFieldBoost</a> — Sets the index-time boost value for a field</li><li><a href="solrinputdocument.sort.html">SolrInputDocument::sort</a> — Sorts the fields within the document</li><li><a href="solrinputdocument.toarray.html">SolrInputDocument::toArray</a> — Returns an array representation of the input document</li></ul>
</div>
</div></div></body></html>